/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package collections;

import java.util.ArrayList;

/**
 *
 * @author Iskandar Sarkawi
 */
public class ArrayListExample1 {
    public static void main(String[] args) {
        //http://www.anyexample.com/programming/java/java_arraylist_example.xml
        /*
         * ArrayList class provides methods for basic array operations:
            add( Object o ) - puts reference to object into ArrayList
            get( int index ) - retrieves object reference from ArrayList index position
            size() - returns ArrayList size
            remove( int index ) - removes the element at the specified position in this list. Shifts any subsequent elements to the left and returns the element that was removed from the list.
            indexOf( Object o) - finds the index in this list of the first occurrence of the specified element
            clear() - removes all of the elements
         */

        //ArrayList can only store object not primitive data type.
        ArrayList<String> notes = new ArrayList<String>();
        notes.add("mynotes1");
        notes.add("mynotes2");
        notes.add("mynotes3");
        notes.add("mynotes4");
        //no resized needed

        System.out.println(notes.get(0));
        System.out.println(notes.get(1));
        System.out.println(notes.get(2));
        System.out.println(notes.get(3));


        
    }

}
